home *** CD-ROM | disk | FTP | other *** search
- head 1.23;
- branch ;
- access ;
- symbols ;
- locks jhh:1.23; strict;
- comment @@;
-
-
- 1.23
- date 92.06.10.13.04.40; author jhh; state Exp;
- branches ;
- next 1.22;
-
- 1.22
- date 91.12.13.13.33.55; author jhh; state Exp;
- branches ;
- next 1.21;
-
- 1.21
- date 91.11.03.17.51.32; author jhh; state Exp;
- branches ;
- next 1.20;
-
- 1.20
- date 91.04.11.12.53.28; author kupfer; state Exp;
- branches ;
- next 1.19;
-
- 1.19
- date 90.03.12.23.26.54; author jhh; state Exp;
- branches ;
- next 1.18;
-
- 1.18
- date 89.10.09.21.28.07; author rab; state Exp;
- branches ;
- next 1.17;
-
- 1.17
- date 89.08.18.11.21.36; author douglis; state Exp;
- branches ;
- next 1.16;
-
- 1.16
- date 89.08.17.11.15.58; author douglis; state Exp;
- branches ;
- next 1.15;
-
- 1.15
- date 89.04.06.21.40.20; author jhh; state Exp;
- branches ;
- next 1.14;
-
- 1.14
- date 88.12.04.12.36.28; author ouster; state Exp;
- branches ;
- next 1.13;
-
- 1.13
- date 88.08.12.14.38.25; author ouster; state Exp;
- branches ;
- next 1.12;
-
- 1.12
- date 88.07.21.11.35.03; author douglis; state Exp;
- branches ;
- next 1.11;
-
- 1.11
- date 88.07.20.10.22.24; author ouster; state Exp;
- branches ;
- next 1.10;
-
- 1.10
- date 88.07.19.17.06.08; author douglis; state Exp;
- branches ;
- next 1.9;
-
- 1.9
- date 88.06.29.14.29.57; author ouster; state Exp;
- branches ;
- next 1.8;
-
- 1.8
- date 88.06.17.16.28.08; author ouster; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 88.06.06.08.34.48; author ouster; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 88.06.05.17.42.09; author ouster; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 88.06.05.14.23.45; author deboor; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 88.04.29.18.43.09; author deboor; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.03.31.17.14.39; author deboor; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.03.19.18.15.50; author deboor; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.03.18.15.06.39; author deboor; state Exp;
- branches ;
- next ;
-
-
- desc
- @Subscript for top-level kernel source directory
- @
-
-
- 1.23
- log
- @make sure all makefiles include TYPE
- @
- text
- @#!/sprite/cmds/csh -f
- #
- # A script to generate (or regenerate) a kernel module Makefile
- # from a prototype Makefile. If ./Makefile.proto exists, use it, else
- # use a common prototype.
- #
- # This script is invoked from mkmf.
- #
- # Parameters passed in from mkmf as environment variables:
- # DOMACHINES names of machines we are supposed to run mkmf on
- # MKMFDIR directory containing prototype makefiles
- # MKMFFLAGS arguments to all mkmfs run recursively
- # MACHINES list of machine names (e.g. "sun2 sun3"), for
- # which there are machine-specific subdirectories
- # (sun2.md, sun3.md) to hold the object files and
- # any machine-specific source files to use when
- # compiling for that machine
- # MAKEFILE name of makefile to create
- # SUBTYPE information about the type makefile
- #
- # $Header: /sprite/lib/mkmf/RCS/mkmf.kernel,v 1.22 91/12/13 13:33:55 jhh Exp $ (SPRITE) Berkeley
- #
-
- onintr cleanup
-
- #
- # Argument processing. (Generalized form, even though just one flag so far.)
- #
- set type=$0
- set type=$type:e
-
- while ($#argv >= 1)
- if ("$1" == '-x') then
- set echo
- endif
- shift
- end
- set subtype=$SUBTYPE
- set name=$cwd:t
- set pref='[a-z_A-Z]'
- set machines=($MACHINES)
- set domachines = ($DOMACHINES)
- set makefile=$MAKEFILE
- set distdir=($DISTDIR)
-
- if (-e $makefile.proto) then
- set proto=$makefile.proto
- else
- set proto="${MKMFDIR}/Makefile.$type"
- endif
-
- echo "Generating $makefile for module $name from $proto"
-
-
- set nonomatch
- set hdrs =( ${name}*.h )
- if ("$hdrs" == "${name}*.h") set hdrs=()
- set pubHdrs=(`echo $hdrs | sed -e "s/[^ ]*Int.h//g"`)
- set allSrcs =( ${pref}*.[cylsp] )
- #
- # Check to see if there were any sources. The first check (size == 1)
- # is only necessary because the second check will cause an error if
- # allSrcs contains more than 1024 bytes.
- #
- if ($#allSrcs == 1) then
- if ("$allSrcs" == "${pref}*.[cylsp]") set allSrcs=()
- endif
- set mdsrcs =( *.md/${pref}*.[cylsp] )
- if ($#mdsrcs == 1) then
- if ("$mdsrcs" == "*.md/${pref}*.[cylsp]") set mdsrcs=()
- endif
- set allSrcs=($allSrcs $mdsrcs)
- set mdhdrs =( *.md/${pref}*.h )
- if ($#mdhdrs == 1) then
- if ("$mdhdrs" == "*.md/${pref}*.h") set mdhdrs=()
- endif
- set allHdrs =($hdrs $mdhdrs)
- unset nonomatch
-
- #
- # Use sed to substitute various interesting things into the prototype
- # makefile. The code below is a bit tricky because some of the variables
- # being substituted in can be very long: if the substitution is passed
- # to sed with "-e", the entire variable must fit in a single shell argument,
- # with a limit of 1024 characters. By generating a separate script file
- # for the very long variables, the variables get passed through (to the
- # script file) as many arguments, which gets around the length problem.
- #
-
- rm -f mkmf.tmp.sed
- echo s,"@@(ALLSRCS)",$allSrcs,g > mkmf.tmp.sed
- echo s,"@@(ALLHDRS)",$allHdrs,g >> mkmf.tmp.sed
- cat $proto | sed -f mkmf.tmp.sed \
- -e "s,@@(DATE),`date`,g" \
- -e "s,@@(MACHINES),$machines,g" \
- -e "s,@@(MAKEFILE),$makefile,g" \
- -e "s,@@(NAME),$name,g" \
- -e "s,@@(PUBHDRS),$pubHdrs,g" \
- -e "s,@@(TEMPLATE),$proto,g" \
- -e "s, $name.ln,,g" \
- -e "s,@@(DISTDIR),$distdir,g" \
- -e "s,@@(TYPE),$subtype,g" \
- > $makefile
- rm -f mkmf.tmp.sed
-
- setenv PARENTDIR $cwd
-
- if ($#domachines != 1) then
- cat << EOF > "#mkmf.$$"
- all :: $domachines
- $domachines ::
- @@ cd \$@@.md
- @@ mkmf \$MKMFFLAGS -f md.mk
- @@ mv md.mk md.mk.tmp
- @@ sed -e "s| \$@@\.md/$name\.o||g" md.mk.tmp > md.mk
- @@ rm -f md.mk.tmp
- EOF
- pmake -f "#mkmf.$$"
- else
- foreach i ($domachines)
- (cd $i.md; mkmf $MKMFFLAGS -f md.mk; mv md.mk md.mk.tmp; sed -e "s| $i\.md/$name\.o||g" md.mk.tmp > md.mk; rm -f md.mk.tmp)
- end
- endif
-
- cleanup:
- rm -f "#mkmf.$$" mkmf.tmp.sed
- @
-
-
- 1.22
- log
- @added ALLHDRS variable
- @
- text
- @d19 1
- d21 1
- a21 1
- # $Header: /sprite/lib/mkmf/RCS/mkmf.kernel,v 1.21 91/11/03 17:51:32 jhh Exp $ (SPRITE) Berkeley
- d38 1
- a38 1
-
- d102 1
- @
-
-
- 1.21
- log
- @Generates md.mk files in parallel if multiple machine types are being
- mkmf'ed
- @
- text
- @d20 1
- a20 1
- # $Header: /sprite/lib/mkmf/RCS/mkmf.kernel,v 1.20 91/04/11 12:53:28 kupfer Exp Locker: jhh $ (SPRITE) Berkeley
- d72 5
- d91 1
- @
-
-
- 1.20
- log
- @Flush DEFTARGET: the default target is now determined by a pmake
- library file.
- @
- text
- @d20 1
- a20 1
- # $Header: /sprite/lib/mkmf/RCS/mkmf.kernel,v 1.19 90/03/12 23:26:54 jhh Exp Locker: kupfer $ (SPRITE) Berkeley
- d23 2
- d99 20
- a118 3
- foreach i ($domachines)
- (cd $i.md; mkmf $MKMFFLAGS -f md.mk; mv md.mk md.mk.tmp; sed -e "s| $i\.md/$name\.o||g" md.mk.tmp > md.mk; rm -f md.mk.tmp)
- end
- @
-
-
- 1.19
- log
- @checks its name to find corresponding Makefile. This makes it
- possible to use different makefiles with the same script.
- @
- text
- @a9 1
- # DEFTARGET name of default target
- d20 1
- a20 1
- # $Header: /sprite/lib/mkmf/RCS/mkmf.kernel,v 1.18 89/10/09 21:28:07 rab Exp $ (SPRITE) Berkeley
- a40 1
- set defTarget=($DEFTARGET)
- a85 1
- -e "s,@@(DEFTARGET),${defTarget:q},g" \
- @
-
-
- 1.18
- log
- @Modifications for distribution.
- @
- text
- @d21 1
- a21 1
- # $Header: /sprite/lib/mkmf/RCS/mkmf.kernel,v 1.17 89/08/18 11:21:36 douglis Exp Locker: rab $ (SPRITE) Berkeley
- d27 3
- d48 1
- a48 1
- set proto="${MKMFDIR}/Makefile.kernel"
- @
-
-
- 1.17
- log
- @another change for TM -- use single machine if it exists, else \ds3100
- @
- text
- @d21 1
- a21 1
- # $Header: /sprite/lib/mkmf/RCS/mkmf.kernel,v 1.15 89/04/06 21:40:20 jhh Exp Locker: douglis $ (SPRITE) Berkeley
- d40 1
- d92 1
- @
-
-
- 1.16
- log
- @removed DEFTARGET -- we use $MACHINE now
- @
- text
- @d10 1
- d39 1
- d84 1
- @
-
-
- 1.15
- log
- @added abilty to make specific machine types
- @
- text
- @a9 1
- # DEFTARGET name of default target
- d20 1
- a20 1
- # $Header: /sprite/lib/mkmf/RCS/mkmf.kernel,v 1.14 88/12/04 12:36:28 ouster Exp $ (SPRITE) Berkeley
- a37 1
- set defTarget=($DEFTARGET)
- a81 1
- -e "s,@@(DEFTARGET),$defTarget,g" \
- @
-
-
- 1.14
- log
- @Final (?) upgrades to kick in new C library.
- @
- text
- @d10 2
- d21 1
- a21 1
- # $Header: /sprite/lib/mkmf/RCS/mkmf.kernel,v 1.13 88/08/12 14:38:25 ouster Exp Locker: ouster $ (SPRITE) Berkeley
- d37 1
- d39 1
- a48 5
- if (" $machines " =~ *\ sun3\ *) then
- set defTarget=sun3
- else
- set defTarget=$machines[1]
- endif
- d94 2
- a95 1
- foreach i ($machines)
- @
-
-
- 1.13
- log
- @No need to look for MAKEFILE or MACHINES. Also, be more restrictive
- on which headers are exported.
- @
- text
- @d19 1
- a19 8
- # Variables generated here:
- # module module to create (directories are assumed to be named
- # after the modules they create)
- # pref prefix pattern that files must match to be included
- # makefile name of the makefile to create
- # proto name of prototype makefile to use to create $makefile
- # machines variable equivalent to MACHINES; needed because env
- # variables can't always be used where variables can.
- a20 2
- # $Header: mkmf.kernel,v 1.12 88/07/21 11:35:03 douglis Exp $ (SPRITE) Berkeley
- #
- d32 1
- a32 1
- set module=$cwd:t
- d43 1
- a43 1
- echo "Generating $makefile for module $module from $proto"
- d52 2
- a53 2
- set hdrs =( ${module}*.h )
- if ("$hdrs" == "${module}*.h") set hdrs=()
- d84 2
- a85 1
- -e "s,@@(MODULE),$module,g" \
- d87 2
- a88 1
- -e "s,@@(DEFTARGET),$defTarget,g" \
- a89 1
- -e "s,@@(MAKEFILE),$makefile,g" \
- d91 1
- a91 2
- -e "s,@@(DATE),`date`,g" \
- -e "s, $module.ln,,g" \
- d96 1
- a96 1
- (cd $i.md; mkmf $MKMFFLAGS -f md.mk; mv md.mk md.mk.tmp; sed -e "s| $i\.md/$module\.o||g" md.mk.tmp > md.mk; rm -f md.mk.tmp)
- @
-
-
- 1.12
- log
- @added ability to turn on echoing for all mkmf's invoked.
- @
- text
- @d28 1
- a28 1
- # $Header: mkmf.kernel,v 1.11 88/07/20 10:22:24 ouster Exp $ (SPRITE) Berkeley
- a42 5
-
- if ($?MACHINES == 0) then
- echo "No target machines for $module"
- exit 1
- endif
- d44 1
- a44 4
- if ("$machines" == "") then
- echo "No target machines for $module"
- exit 1
- endif
- a45 6
- if ($?MAKEFILE) then
- set makefile=$MAKEFILE
- else
- set makefile=Makefile
- endif
-
- d61 2
- a62 2
- set hdrs =( ${pref}*.h )
- if ("$hdrs" == "${pref}*.h") set hdrs=()
- a106 2
-
- pmake dependall
- @
-
-
- 1.11
- log
- @Add code to be more careful about long lists of source files.
- @
- text
- @d11 1
- d28 1
- a28 1
- # $Header: mkmf.kernel,v 1.10 88/07/19 17:06:08 douglis Exp $ (SPRITE) Berkeley
- d31 10
- d119 1
- a119 1
- (cd $i.md; mkmf -f md.mk; mv md.mk md.mk.tmp; sed -e "s| $i\.md/$module\.o||g" md.mk.tmp > md.mk; rm -f md.mk.tmp)
- @
-
-
- 1.10
- log
- @temporary (I hope!) patch to get mkmf to work even with
- lots and lots of files in *.md.
- @
- text
- @d27 1
- a27 1
- # $Header: mkmf.kernel,v 1.9 88/06/29 14:29:57 ouster Exp $ (SPRITE) Berkeley
- d68 8
- a75 1
- if ("$allSrcs" == "${pref}*.[cylsp]") set allSrcs=()
- a76 2
- # do an extra check because the == test can cause an error if > 1024 bytes
- # in $mdsrcs.
- @
-
-
- 1.9
- log
- @Had bad error message for missing .md directories.
- @
- text
- @d27 1
- a27 1
- # $Header: mkmf.kernel,v 1.8 88/06/17 16:28:08 ouster Exp $ (SPRITE) Berkeley
- d70 5
- a74 1
- if ("$mdsrcs" == "*.md/${pref}*.[cylsp]") set mdsrcs=()
- @
-
-
- 1.8
- log
- @Changes to handle directories with many many files.
- @
- text
- @d27 1
- a27 1
- # $Header: mkmf.kernel,v 1.7 88/06/06 08:34:48 ouster Exp $ (SPRITE) Berkeley
- d34 1
- a34 1
- echo "No target machines for $prog"
- d39 1
- a39 1
- echo "No target machines for $prog"
- @
-
-
- 1.7
- log
- @Remove this module from lint library list, print out real name
- of makefile when it's not "Makefile".
- @
- text
- @d27 1
- a27 1
- # $Header: mkmf.kernel,v 1.6 88/06/05 17:42:09 ouster Exp $ (SPRITE) Berkeley
- d75 7
- a81 3
- # Generate the Makefile, making appropriate substitutions. The $module.ln
- # substitution is to remove the module's own installed .ln file from the
- # list of lint libraries to use when linting this module.
- d84 3
- a86 1
- cat $proto | sed \
- d88 1
- a88 1
- -e "s,@@(MACHINES),$MACHINES,g" \
- d90 1
- a90 1
- -e "s,@@(ALLSRCS), $allSrcs,g" \
- a91 1
- -e "s,@@(PUBHDRS),$pubHdrs,g" \
- d94 3
- a96 1
- -e "s, $module.ln,,g" > $makefile
- @
-
-
- 1.6
- log
- @Changed kernel stuff to parallel commands and library.
- @
- text
- @d27 1
- a27 1
- # $Header: mkmf.kernel,v 1.4 88/04/29 18:43:09 deboor Exp $ (SPRITE) Berkeley
- d55 1
- a55 1
- echo "Generating a Makefile for module $module from $proto"
- d74 6
- d88 2
- a89 1
- -e "s,@@(DATE),`date`,g" > $makefile
- @
-
-
- 1.5
- log
- @JO checking in for deboor.
- @
- text
- @d4 2
- a5 2
- # from a prototype Makefile. This version is intended to work with
- # subdirectories corresponding to two machine types, sun2 and sun3.
- d7 20
- a28 1
- set path = (/sprite/cmds /sprite/local/cmds /sprite/att/cmds)
- d31 1
- d33 10
- a53 1
- echo "Generating a Makefile for $module module from $proto"
- d55 1
- a55 9
- #
- # Find all machine-independent source and header files
- #
- set nonomatch pref='[a-z_]'
- set Cfiles=(${pref}*.c)
- set Hfiles=(${pref}*.h)
- set Sfiles=(${pref}*.s)
- # Pfiles is public header files. In sun & utils, the prefix convention is
- # not kept so make sure all files are "public".
- d57 2
- a58 2
- if ($module == "sun" || $module == "utils" || $module == "mach") then
- set Pfiles = ($Hfiles)
- d60 1
- a60 1
- set Pfiles=(${module}*.h)
- d62 10
- a73 12
- #
- # Make sure the variables contain valid values: because of nonomatch being
- # set, if no matching files are found, they will contain such things as
- # [a-z]_*.c, which is unhelpful.
- #
- if ("$Cfiles" == "${pref}*.c") set Cfiles=()
- if ("$Hfiles" == "${pref}*.h") set Hfiles=()
- if ("$Sfiles" == "${pref}*.s") set Sfiles=()
- if ("$Pfiles" == "${module}*.h" || "$Pfiles" == "${pref}*.h") set Pfiles=($Hfiles)
-
- if (-e Makefile) mv Makefile Makefile.$$~
-
- d75 1
- d77 4
- a80 5
- -e "s,@@(MODULE),$module,g" \
- -e "s,@@(CSRCS),$Cfiles,g" \
- -e "s,@@(SSRCS),$Sfiles,g" \
- -e "s,@@(HDRS),$Hfiles,g" \
- -e "s,@@(PUBHDRS),$Pfiles,g" \
- a81 1
- -e "s,$module\.ln,,g" \
- d84 3
- a86 3
- if ("$MACHINES" == "") then
- echo Warning: no machine-dependent directories exist.
- endif
- d88 1
- a88 1
- make mkmf
- @
-
-
- 1.4
- log
- @Added use of $MACHINES and handled empty Pfiles in sun and
- utils.
- @
- text
- @d4 1
- a4 1
- # from the prototype Makefile. This version is intended to work with
- d7 1
- a7 1
- # $Header: mkmf.kernel,v 1.3 88/03/31 17:14:39 deboor Exp $ (SPRITE) Berkeley
- d36 1
- a36 1
- if ($module == "sun" || $module == "utils") then
- @
-
-
- 1.3
- log
- @*** empty log message ***
- @
- text
- @d7 1
- a7 1
- # $Header: mkmf.kernel,v 1.2 88/03/19 18:15:50 deboor Exp $ (SPRITE) Berkeley
- d51 1
- a51 1
- if ("$Pfiles" == "${module}*.h") set Pfiles=($Hfiles)
- d56 1
- d66 3
- a68 1
- if (! -e Object.sun2) mkdir Object.sun2 Object.sun3
- @
-
-
- 1.2
- log
- @Adapted to mkmf
- @
- text
- @d7 1
- a7 1
- # $Header$ (SPRITE) Berkeley
- d25 4
- d62 1
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d7 2
- a9 1
- rehash
- d11 1
- a11 2
- set module=`pwd`
- set module=$module:t
- d13 5
- a17 1
- echo "Generating a Makefile for module: $module"
- d19 10
- a28 6
- unalias ls
- set nonomatch
- set Cfiles=`ls [a-z_]*.c`
- set Hfiles=`ls [a-z_]*.h`
- set Sfiles=`ls [a-z_]*.s`
-
- d35 1
- a35 1
- set Pfiles=`ls ${module}*.h`
- d37 1
- d39 10
- d51 8
- a58 5
- if (-e Makefile.proto) then
- set proto=Makefile.proto
- else
- set proto=/sprite/src/lib/makemake/Makefile.kernel
- endif
- a59 24
- cat $proto | \
- sed -e "s/module-name/$module/" \
- -e "s/^CSRCS.*/CSRCS = $Cfiles/" \
- -e "s/^ASMSRCS.*/ASMSRCS = $Sfiles/" \
- -e "s/^HDRS.*/HDRS = $Hfiles/" \
- -e "s/^PUBHDRS.*/PUBHDRS = $Pfiles/" \
- > Makefile
-
- # -e "s/^OBJS.*/OBJS = $Ofiles/" \
- # -e "s/^POBJS.*/POBJS = $POfiles/" \
- # -e "s/..LINT.\/$module\.ln//" \
-
- if (-e Makefile.sed) then
- echo "Modifying with Makefile.sed."
- mv Makefile{,.$$~~}
- sed -f Makefile.sed Makefile.$$~~ > Makefile
- rm Makefile.$$~~
- endif
-
- if (-e Makefile.ex) then
- echo "Modifying with Makefile.ex."
- ex - Makefile < Makefile.ex
- endif
-
- d62 1
- a62 1
- make makemake
- @
-